package com.huanhuan.index;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

import java.io.IOException;

//TODO 1.环境准备
public class ESTest_Client {
    public static void main(String[] args) throws Exception {

        //1.创建客户端对象
        //创建服务主机名 和 Web 通信端口
        final String hostname = "localhost";
        final int port = 9200;
        final String scheme = "http";
        HttpHost httpHost = new HttpHost( hostname, port, scheme );


        RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(httpHost)
        );


        //关闭ES 资源
        client.close();


    }
}
